package com.oa.business.dict;

import com.oa.common.result.Result;
import com.oa.framework.FrameworkEngine;
import com.oa.framework.org.department.domain.Department;
import com.oa.framework.org.domain.Duty;
import com.oa.framework.org.domain.Position;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 远程支持字典
 * @author cuichao
 */
@RestController
@RequestMapping("dict")
public class DictController {


    /**
     * 加载职务列表
     * @return
     */
    @GetMapping("duties")
    public Result loadDuties(){
        List<Duty> duties = FrameworkEngine.getDutyService().loadEnableDuties();
        return Result.success(duties);
    }

    /**
     * 加载职位列表
     * @return
     */
    @GetMapping("positions")
    public Result loadPositions(){
        List<Position> positions = FrameworkEngine.getPositionService().loadEnablePositions();
        return Result.success(positions);
    }

    /**
     * 加载组织机构携带职位
     * @return
     */
    @GetMapping("department")
    public Result loadDepartment(){
        List<Department> departments = FrameworkEngine.getDepartmentService().loadDepartmentIncludeDuties();
        return Result.success(departments);
    }
}
